package net.csdra.libraryborrowing.domain.user;

import net.csdra.libraryborrowing.domain.EntityBase;

import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import java.util.List;

/**
 * Created by msf on 2017/9/29.
 */
@Entity
public class User extends EntityBase {
    @Column(unique = true)
    String userName;
    String password;
    String nikiName;
    //头像
    String cover;
    //微信用户id
    @Column(unique = true)
    String openId;
    //值使用UserAuthoriry的常量
    @ElementCollection
    List<String> authoritys;

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public String getCover() {
        return cover;
    }

    public void setCover(String cover) {
        this.cover = cover;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
        if (this.openId == null) {
            this.openId = userName;
        }
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNikiName() {
        return nikiName;
    }

    public void setNikiName(String nikiName) {
        this.nikiName = nikiName;
    }

    public List<String> getAuthoritys() {
        return authoritys;
    }

    public void setAuthoritys(List<String> authoritys) {
        this.authoritys = authoritys;
    }
}
